package com.jtlrm.ckd.mvp.model;

import com.base.sdk.base.model.BaseModel;
import com.base.sdk.base.net.LifeCycleEvent;
import com.google.gson.JsonObject;
import com.jtlrm.ckd.entity.submitEntity.HuanZheJianDangData;
import com.jtlrm.ckd.net.RetrofitUtil;

import io.reactivex.Observer;
import io.reactivex.subjects.PublishSubject;

public class HuanZheGuanLiModel extends BaseModel {

    /**
     * 查询患者列表
     *
     * @param num
     * @param size
     * @param Keyword
     * @param observer
     * @param lifecycleSubject
     */
    public void queryHuanZheList(int num, int size, String Keyword, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("PageIndex", num);
        jsonObject.addProperty("PageSize", size);
        jsonObject.addProperty("Keyword", Keyword);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryHuanZheListByKeyWords(jsonObject), observer, lifecycleSubject);
    }

    public void queryHuanZheBasic(String PatientId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("PatientId", PatientId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryHuanZheBasic(jsonObject), observer, lifecycleSubject);
    }

    public void createHuanZheDangAn(HuanZheJianDangData dangData, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().createHuanZhe(createBody(dangData)), observer, lifecycleSubject);
    }

    public void queryHuanZheByPhone(String Mobile, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("Mobile", Mobile);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryHuanZheListByKeyPhone(jsonObject), observer, lifecycleSubject);
    }

    public void querySuiFangRenShu(Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().querySuiFangRenShu(), observer, lifecycleSubject);
    }

    public void queryShenHeRenShu(Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShenHeRenShu(), observer, lifecycleSubject);
    }

    public void changeRemark(String Id, String Remark,Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("Id", Id);
        jsonObject.addProperty("Remark", Remark);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().changeRemark(jsonObject), observer, lifecycleSubject);
    }
}
